package com.jz.controller;

import com.jz.module.dto.AdminDto;
import com.jz.service.LoginService;
import com.jz.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @RequestMapping("/login")
    public ResultUtil login(AdminDto adminDto){
        AdminDto dto = loginService.login(adminDto);
        if (dto == null){
            return ResultUtil.error("用户名或密码错误");
        }
        return ResultUtil.success(dto);
    }

}
